const fs=require('fs')

const express=require('express')
 const morgan=require('morgan')
 
const app=express()
//通过文件模块创建写入流
const writer=fs.createWriteStream('./logs',{
    encoding:'utf-8',
    flags:"a+"
})
//使用中间件
 app.use(morgan("combined",{stream:writer}))
app.use(express.json())
 
app.post('/login',(req,res,next)=>{
    console.log(req.body)
    res.end("响应成功")
})


app.listen(8000,()=>{
    console.log('服务器响应成功')
})